/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.dao.impl;

import java.util.LinkedHashMap;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.ruipengkj.bean.TShopCharge;
import com.ruipengkj.commons.base.query.PageModel;
import com.ruipengkj.commons.dao.GenericDao;
import com.ruipengkj.dao.TShopChargeDao;
/**
 * 说明：
 * 商店充值规则dao层接口实现
 * @Author：李智深
 * @Date：2012-03-16
 */
@Repository
public class TShopChargeDaoImpl extends GenericDao<TShopCharge,String> implements TShopChargeDao {

	@Override
	public PageModel<TShopCharge> getTShopChargeService(int firstResult,
			int maxResult, TShopCharge entity) throws Exception {
		// TODO Auto-generated method stub
		return this.getTShopChargeService(firstResult, maxResult, entity);
	}

	@Override
	public PageModel<TShopCharge> getTShopChargeService(String hql,
			String whereHQL, List<Object> param, int firstResult,
			int maxResult, LinkedHashMap<String, String> orderby)
			throws RuntimeException {
		// TODO Auto-generated method stub
		return this.getTShopChargeService(hql, whereHQL, param, firstResult, maxResult, orderby);
	}

	@Override
	public Double findAMountByWorkShiftID(String WorkShiftID) {
		Session session = getHiberanteTemplate().getSessionFactory().openSession();
		Query query = session.createSQLQuery("select sum(AMount) form ruipeng_tb_tshopcharge where WorkShiftID = ?");
		query.setParameter(0, WorkShiftID);
		return (Double) query.uniqueResult();
	}

}